import axios from '@/plugins/axios'
import url from './url.js'

var API = {};

// 获取腾讯云token
API.cosToken = function() {
	return axios.get(url.CosToken)
}

// 获取七牛云token
API.qiniuToken = function() {
	return axios.get(url.QiniuToken);
}

// 百度接口
// 新增
API.aip = function(data) {
	return axios.post(url.Aip, data)
}

// 获取
API.aips = function(page, limit) {
	return axios.get(url.Aips, {
		page: page,
		limit: limit
	})
}

// 删除
API.delAip = function(id) {
	return axios.del(url.Aip, {
		id: id
	})
}

// 项目管理
// 新增
API.project = function(data) {
	return axios.post(url.Project, data)
}

// 获取
API.projects = function(page, limit) {
	return axios.get(url.Projects, {
		page: page,
		limit: limit
	})
}

// 删除
API.delProject = function(id) {
	return axios.del(url.Project, {
		id: id
	})
}

// 固件管理
// 新增
API.apk = function(data) {
	return axios.post(url.Apk, data)
}

// 获取
API.apks = function(page, limit) {
	return axios.get(url.Apks, {
		page: page,
		limit: limit
	})
}

// 删除
API.delApk = function(id) {
	return axios.del(url.Apk, {
		id: id
	})
}

// 固件版本管理
// 新增
API.apkVersion = function(data) {
	return axios.post(url.ApkVersion, data)
}

// 获取
API.apkVersions = function(page, limit, apk_id) {
	return axios.get(url.ApkVersions, {
		page: page,
		limit: limit,
		apk_id: apk_id
	})
}

// 删除
API.delApkVersion = function(id) {
	return axios.del(url.ApkVersion, {
		id: id
	})
}

// 发布
API.publishApk = function(data) {
	console.log(2323, data)
	return axios.post(url.PublishApk, data)
}

// 地区管理
// 获取社区列表（省市区选中）
API.areas = function(page, limit, parent_id, title) {
	return axios.get(url.Areas, {
		page: page,
		limit: limit,
		parent_id: parent_id,
		title: title
	})
}

// 新增地区
API.area = function(data) {
	return axios.post(url.Area, data)
}

// 删除地区
API.delArea = function(id) {
	return axios.del(url.Area, {
		id: id
	})
}

// 人脸开关
// 新增开关
API.faceSwitch = function(data) {
	return axios.post(url.FaceSwicth, data)
}

// 删除开关
API.delFaceSwitch = function(id) {
	return axios.del(url.FaceSwicth, {
		id: id
	})
}

// 获取开关
API.faceSwitches = function(page, limit) {
	return axios.get(url.FaceSwicthes, {
		page: page,
		limit: limit
	})
}

// 地址管理
// 获取地址
API.addresses = function(page, limit, format, area_id, project_id, search, bind) {
	return axios.get(url.Addresses, {
		page: page,
		limit: limit,
		format: format,
		area_id: area_id,
		project_id: project_id,
		search: search,
		bind: bind
	})
}

// 搜索地址
API.searchAddresses = function(area_id, project_id, search) {
	return axios.get(url.Addresses, {
		area_id: area_id,
		project_id: project_id,
		search: search
	})
}

// 搜索单个地址
API.oneAddresses = function(search) {
	return axios.get(url.Addresses, {
		search: search
	})
}

// 新增
API.address = function(data) {
	return axios.post(url.Address, data)
}

// 新增地址代码
API.addressCode = function(data) {
	return axios.post(url.AddressInfo, data)
}

// 新增地址人脸组
API.postAddressGroups = function(data) {
	return axios.post(url.AddressGroups, data)
}

// 新增地址辖区
API.addressStations = function(data) {
	return axios.post(url.AddressStations, data)
}

// 新增地址维护人员
API.addressRepairers = function(data) {
	return axios.post(url.AddressRepairers, data)
}

// 获取地址类型
API.addressType = function() {
	return axios.get(url.AddressTypes)
}

// 获取详细地址
API.getIdAddress = function(id) {
	return axios.get(url.IdAddress, {
		id: id
	})
}
	
// 获取维护人员
API.getIdAddressRepairer = function(address_id) {
	return axios.get(url.IdAddressRepairers, {
		address_id: address_id
	})
}

// 获取地址辖区信息
API.getIdAddressStations = function(address_id) {
	return axios.get(url.IdAddressStations, {
		address_id: address_id
	})
}

// 获取地址编码信息
API.getIdAddressInfo = function(address_id) {
	return axios.get(url.IdAddressInfo, {
		address_id: address_id
	})
}

// 获取地址人脸组
API.getIdAddressGroups = function(address_id) {
	return axios.get(url.IdAddressGroups, {
		address_id: address_id
	})
}

// 删除地址
API.delAddress = function(id) {
	return axios.del(url.Address, {
		id: id
	})
}

// 新增房间
API.room = function(data) {
	return axios.post(url.Rooms, data)
}

API.rooms = function(address_id, page, limit) {
	return axios.get(url.Rooms, {
		address_id: address_id,
		page: page,
		limit: limit
	})
}

// 删除房间号
API.delRoom = function(id) {
	return axios.del(url.Room, {
		id: id
	})
}

// 地址信息服務詳情
API.addressInfoService = function(address_id) {
	return axios.get(url.PushAddressStatus, {
		address_id: address_id
	})
}

// 推送详情
API.pushAddress = function(data) {
	return axios.post(url.PushAddress, data)
}

// 查看详情
API.addressTransmitDetail = function(type, id) {
	return axios.get(url.AddressTransmit, {
		type: type,
		id: id
	})
}

// 获取人口地址
API.addressMultiFaces = function(address_id) {
	return axios.get(url.AddressMultiFaces, {
		address_id: address_id
	})
}

// 新增维护人员
API.maintenance = function(data) {
	return axios.post(url.Repairer, data)
}

// 获取维护人员
API.maintenances = function(page, limit, name, phone) {
	return axios.get(url.Repairers, {
		page: page,
		limit: limit,
		name: name,
		phone: phone
	})
}

// 删除维护人员
API.delMaintenance = function(id) {
	return axios.del(url.Repairer, {
		id: id
	})
}

// 设备管理
API.devices = function(page, limit, format, area_id, uuid, address, direction, type, address_id, addresses_id) {
	return axios.get(url.Devices, {
		page: page,
		limit: limit,
		format: format,
		area_id: area_id,
		uuid: uuid,
		address: address,
		direction: direction,
		type: type,
		address_id: address_id,
		addresses_id: addresses_id
	});
}

// 新增设备
API.device = function(data) {
	return axios.post(url.Device, data);
}

// 设备配置
API.deviceConfig = function(device_id, device_type) {
	return axios.get(url.DeviceConfigs, {
		device_id: device_id,
		device_type: device_type
	});
}

// 提交设备配置
API.deviceConfigs = function(data) {
	return axios.post(url.DeviceConfigs, data);
}

// 根据uuid获取设备数据(未绑定设备)
API.unknownDevice = function(uuid) {
	return axios.get(url.UnknownDevices, {
		uuid: uuid
	});
}

// 获取设备类型
API.deviceType = function() {
	return axios.get(url.DeviceTypes);
}

// 获取地址人脸组
API.addressGroups = function(address_id) {
	return axios.get(url.AddressGroups, {
		address_id: address_id
	});
}

// 设备指令
API.deviceCommand = function(page, limit, uuid, command, push_id, state) {
	return axios.get(url.DeviceCommands, {
		page: page,
		limit: limit,
		uuid: uuid,
		command: command,
		push_id: push_id,
		state: state
	});
}

// 获取设备心跳
API.heartBeats = function(uuid) {
	return axios.get(url.Heartbeats, {
		uuid: uuid
	});
}

// 获取设备日志
API.deviceLogs = function(page, limit, uuid, type) {
	return axios.get(url.DeviceLogs, {
		page: page,
		limit: limit,
		uuid: uuid,
		type: type,
	});
}

// 获取设备用户
API.deviceUser = function(device_id) {
	return axios.get(url.DeviceUsers, {
		device_id: device_id
	});
}

// 获取设备人脸组
API.deviceGroups = function(device_id) {
	return axios.get(url.DeviceGroups, {
		device_id: device_id
	});
}

// 新增设备人脸组
API.deviceGroup = function(data) {
	return axios.post(url.DeviceGroups, data);
}

// 删除设备人脸组
API.delDeviceGroup = function(group_id) {
	return axios.del(url.DeviceGroup, {
		group_id: group_id
	});
}

// 获取设备离线记录
API.getDeviceOfflineRecord = function(page, limit, device_id) {
	return axios.get(url.DeviceOfflineRecords, {
		page: page,
		limit: limit,
		device_id: device_id,
	})
}

// 获取设备UUID
API.getDeviceUuid = function (uuid, direction, addresses_id) {
    return axios.get(url.Devices, {
        uuid: uuid,
        direction: direction,
        addresses_id: addresses_id,
    })
}

// 辖区管理
API.policeStations = function() {
	return axios.get(url.AllPoliceStations);
}

// 获取公安传输接口
API.transmits = function(page, limit, type, state) {
	return axios.get(url.Transmits, {
		page: page,
		limit: limit,
		type: type,
		state: state
	});
}


// 获取单个
API.oneTransmit = function(id) {
	return axios.get(url.Transmit, {
		id: id
	});
}

API.pushTransmit = function(id) {
	return axios.get(url.PushTransmit, {
		id: id
	});
}

API.transmitType = function() {
	return axios.get(url.TransmitTypes);
}

// 公安统计接口
API.transmitsCount = function() {
	return axios.get(url.TransmitsCount);
}

// 人脸管理
API.faces = function(page, limit, name, face_id) {
	return axios.get(url.Faces, {
		page: page,
		limit: limit,
		name: name,
		face_id: face_id
	})
}

// 推送记录
API.pushLogs = function(page, limit, format, name, uuid, address) {
	return axios.get(url.FacesLogs, {
		page: page,
		limit: limit,
		format: 1,
		name: name,
		uuid: uuid,
		address: address
	})
}

// 推送人脸
API.pushFace = function(data) {
	return axios.post(url.PushFace, data);
}

// 推送记录
API.pushRecords = function(page, limit, name, address) {
	return axios.get(url.PushRecords, {
		page: page,
		limit: limit,
		name: name,
		address: address
	})
}

// 获取人脸地址关系
API.multiFaces = function(page, limit, face_id) {
	return axios.get(url.MultiFaces, {
		page: page,
		limit: limit,
		face_id: face_id,
	})
}


// 获取民族代码列表 
API.getMzdm = function(search) {
	return axios.get(url.Mzdm, {
		search: search
	})
}

// 获取国家或地区列表
API.getGjhdq = function(search) {
	return axios.get(url.Gjhdq, {
		search: search
	})
}

// 获取证件类别代码
API.getZjlb = function(search) {
	return axios.get(url.Zjlb, {
		search: search
	})
}

// 新增人脸
API.face = function(data) {
	return axios.post(url.Face, data);
}

// 删除人脸
API.delFace = function(id) {
	return axios.del(url.Face, {
		id: id
	});
}

// 获取可疑人脸
API.getDangerFaces = function(page, limit, search) {
	return axios.get(url.DangerFaces, {
		page: page,
		limit: limit,
		search: search
	});
}

// 推送全部人脸
API.pushAll = function(data) {
	return axios.post(url.PushDangerFaces, data);
}

// 屏保管理
// 新增屏保
API.screenSaver = function(data) {
	return axios.post(url.Screensaver, data);
}

// 删除屏保
API.delScreenSaver = function(id) {
	return axios.del(url.Screensaver, {
		id: id
	});
}

// 获取屏保
API.getScreensaver = function(page, limit, title) {
	return axios.get(url.Screensavers, {
		page: page,
		limit: limit,
		title: title
	})
}

// 推送屏保
API.pushScreen = function(data) {
	return axios.post(url.PublishScreensaver, data);
}

// 获取屏保推送记录
API.getPushRecord = function(page, limit, title) {
	return axios.get(url.ScreensaverRecords, {
		page: page,
		limit: limit,
		title: title
	})
}


export default API
